package com.wbp.cms.qatest;

public class SingleTest {

	public static void main(String[] args) {
		SingleClassRun scr =new SingleClassRun();
		Thread t1 = new Thread(scr) ;
		Thread t2 = new Thread(scr) ;
		t1.start();
		t2.start(); 
	}

	
	
}

class SingleClassRun implements  Runnable {
	public void run() {
		SingleClass  sc  = SingleClass.getInstance() ;
		System.out.println(sc.test1());
		
	}
}

class SingleClass{
	
	private static SingleClass sc = null ;
	
	private SingleClass(){
		
	}
	public static SingleClass getInstance(){
		if(sc == null){
			synchronized (SingleClass.class) {
				if(sc == null)
				    sc = new SingleClass() ;
			}
		}
		return sc ;
	}
	
	public String  test1(){
		return "singleClass" ;
	}
}
